package com.treasure.mall.biz.service.core.order;

import com.treasure.mall.biz.base.SearchableCrudService;
import com.treasure.mall.biz.entity.order.OrderItemPO;
import com.treasure.mall.biz.entity.order.SettlementBillPO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/7/23
 */
public interface SettlementBillService extends SearchableCrudService<SettlementBillPO, String> {
    SettlementBillPO create(OrderItemPO orderItemPO);

    List<SettlementBillPO> findBySubOrder(String subOrderId);

    SettlementBillPO findByOrderItem(Long orderItemId);

    List<SettlementBillPO> findToConvert();

    @Transactional
    void convert(SettlementBillPO po);

    /**
     * 修改结算单是否失效
     * 产生售后行为时，设置为失效true，售后拒绝或取消售后设置为false
     *
     * @param orderItemId
     * @param invalidate
     */
    void modifyInvalidate(Long orderItemId, boolean invalidate);
}
